package DataStructureAndAlgorithm.CSP.Day14;

import java.util.Scanner;
//模拟题
//3258. 碰撞的小球
//链接：https://www.acwing.com/problem/content/description/3261/
public class AcWing_3258 {
    static class ball{
        int p;
        int v;
        ball(int p,int v){
            this.p = p;
            this.v = v;
        }
    }
    public static void main(String[] args){
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int l = in.nextInt();
        int t = in.nextInt();
        int N = 110;
        ball[] balls = new ball[N];

        for (int j = 0; j < n; j ++){
            int p = in.nextInt();
            balls[j] = new ball(p,1);
        }

        for (int i = 0; i < t; i++){
            //先让小球移动，再判断任意两个小球在移动之后是否重合来判断两个小球是否相撞
            //如果相撞，则让速度方向即可
            for (int j = 0; j < n; j++){
                balls[j].p += balls[j].v;
                //碰墙就速度反向
                if (balls[j].p == l || balls[j].p == 0)
                    balls[j].v *= -1;
            }
            for (int j = 0; j < n; j++){
                for (int k = j + 1; k < n; k++){
                    //任意两个小球相撞
                    if (balls[j].p == balls[k].p){
                        balls[j].v *= -1;
                        balls[k].v *= -1;
                    }
                }
            }
        }
        for (int j = 0; j < n; j++){
            System.out.print(balls[j].p + " ");
        }
    }
}
